<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="对账单 | 网络下单系统 | ${clieUser.clie.estName}" />
<%@ include file="../inc/OnlineTitle.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<link href="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.css" rel="stylesheet" type="text/css">
<script src="/js/popup_ext.js"></script>
<script src="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.js"></script>
<script language="javascript">
	function checkDateStr(){
		var startDate=document.getElementById("start_date").value;
		if(startDate!=null && startDate!=''){
			var arr=startDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','开始日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','开始日期格式不正确',200,100);
				return false;
			}
		}
		var endDate=document.getElementById("end_date").value;
		if(endDate!=null && endDate!=''){
			var arr=endDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','结束日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','结束日期格式不正确',200,100);
				return false;
			}
		}
		return true;
	}
	function doSearch(){
		if(checkDateStr()){
			var startDate=document.getElementById("start_date").value;
			var endDate=document.getElementById("end_date").value;
			var type=document.getElementById("type").value;
			window.location="/online/BusiAcco.ihtm?start_date="+startDate+"&end_date="+endDate+"&type="+type;
		}
	}
	function checkInput(){
		if(window.event.keyCode==13){
			doSearch();
		}
	}
	function setDate(type){
		var d=new Date();
		var startStr="";
		var endStr="";
		
		if(type=="PREVIEW_MONTH"){
			d=new Date(d.getFullYear(),d.getMonth(),1);
			d.setDate(d.getDate()-1);
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-1";
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="CURRENT_MONTH"){
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-01";
			d=new Date(d.getFullYear(),d.getMonth()+1,1);
			d.setDate(d.getDate()-1);
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="END_PREVIEW_MONTH"){
			d=new Date(d.getFullYear(),d.getMonth(),1);
			d.setDate(d.getDate()-1);
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="END_CURRENT_DATE"){
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}
		document.getElementById("start_date").value=startStr;
		document.getElementById("end_date").value=endStr;
	}
</script>
</head>
<body oncontextmenu="return false" class="sheet" style="padding-top:10px;text-align:center;">
<div class="sheet-main" style="width:860px;text-align:left;margin:auto;">
  <div class="sheet-top">
    <div class="content">
      <h2>对账单</h2>
      <p>查询指定日期范围内的账单</p>
    </div>
  </div>
  <div class="sheet-list">
    <div class="search-business">
      <div class="content">
        <table width="100%">
          <tbody>
            <tr>
              <td height="30px">
              	日期
              	<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" id="start_date" name="start_date" value="<c:out value="${startDate}" />">
            	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('start_date'),'yyyy-mm-dd',this,false,'');">
            	至
            	<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" id="end_date" name="end_date" value="<c:out value="${endDate}" />">
            	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('end_date'),'yyyy-mm-dd',this,false,'');">
            	<a href="javascript:setDate('PREVIEW_MONTH');">上月</a>
				<a href="javascript:setDate('CURRENT_MONTH');">本月</a>
				<a href="javascript:setDate('END_PREVIEW_MONTH');">截止上月</a>
				<a href="javascript:setDate('END_CURRENT_DATE');">截止当天</a>
			  </td>
            </tr>
            <tr>
              <td height="30px">
              	类型
              	<select name="type" id="type">
					<option value="JUST_UNCOLLECTED">只显示未收完款的业务单</option>
					<option value="">包括已收完款的业务单</option>
				</select>
			  </td>
            </tr>
            <tr>
              <td height="30px">
	            <input type="button" class="buttom search-but" value=" 查 询" onClick="doSearch();">
			  </td>
            </tr>
           </tbody>      
        </table>
      </div>
	  
      </div>     
    </div>
  </div>
</div>
</body>
</html>